<template>
  <div class="treeCheck">
    <!-- :default-expanded-keys="defaultexpandedKey" -->
    <!-- :default-selected-keys="defaultSelectedKey" -->
    <a-tree
      :tree-data="treeData"
      v-model="checkedKeys"
      checkable
      v-if="treeData.length>0"
      @expand="onExpand"
     
      show-icon
    ></a-tree>
  </div>
</template>

<script>
export default {
  name: 'treeCheck',

  data() {
    return {
      expandedKeys: [],
      defaultCheckedKey: this.$store.state.treeDetailCheck,
      treeData: this.$store.state.treeDetailData,
      checkedKeys:this.$store.state.treeDetailCheck
    }
  },
  mounted() {
    // console.log(dataList);
  },
  watch: {
    checkedKeys(val) {
      this.$forceUpdate()
      this.$store.commit('setTreeDetailCheck', val)
      this.$emit('treeCheck', val)
    },
  },
  methods: {
    onExpand(expandedKeys) {
      this.expandedKeys = expandedKeys
      this.autoExpandParent = false
    },

  }
}
</script>

<style lang="less" scoped>
</style>
